package com.chinemit.cui.utils.popup
{
	import com.chinemit.cui.components.core.CUIComponent;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class PopupMask extends CUIComponent
	{
		private var color:uint = 0;
		
		public function PopupMask( color:uint=0 , alpha:Number =0 )
		{
			super();
		}
		
		override protected function into():void{
			
			super.into();
			//绘制模式窗体
			with(this.graphics){
				clear();
				beginFill( color);
				drawRect(0,0,this.stage.stageWidth,this.stage.stageHeight );
				endFill() ;
			}
			this.stage.addEventListener(Event.RESIZE,stageResizeHandler);
		}
		
		override protected function out():void{
			super.out();
			this.stage.removeEventListener(Event.RESIZE,stageResizeHandler);
		}
		
		/**
		 * 场景变化 
		 * @param event
		 * 
		 */		
		private function stageResizeHandler(event:Event):void {
			with(this.graphics){
				clear();
				beginFill( color);
				drawRect(0,0,this.stage.stageWidth,this.stage.stageHeight );
				endFill() ;
			}	
		}
		
	}
}